home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FUZZY.ZIP / PROVER.S < prev    next >
Text File  |  1986-11-30  |  4KB  |  69 lines

  1. -------------------------------------------------------------------------------
  2. --                                                                           --
  3. --  Library Unit:  Prover -- Prove or process user requests                  --
  4. --                                                                           --
  5. --  Author:  Bradley L. Richards                                             --
  6. --                                                                           --
  7. --     Version     Date     Notes . . .                                      --
  8. --    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    --
  9. --       1.0    - - - - -   Never existed.  First version implemented after  --
  10. --                            Parser et al reached version 2.0               --
  11. --       2.0    20 Jun 86   Initial Version                                  --
  12. --       2.05   13 Jul 86   Split into separate spec and package files       --
  13. --       2.1    21 Jul 86   Demonstration Version                            --
  14. --       2.3    19 Aug 86   Maintain rule base in an AVL tree for efficiency --
  15. --                            Implement functors, asserta, assertz, retract, --
  16. --                            parse, log, ln.                                --
  17. --       3.0    10 Oct 86   Final thesis product                             --
  18. --    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    --
  19. --                                                                           --
  20. --  Library units used:       AVL -- AVL tree package                        --
  21. --                       Data_def -- common data definitions                 --
  22. --                        Listing -- error and warning message routines      --
  23. --                           Math -- Verdix math package (for LN, LOG, etc.) --
  24. --                         Parser -- Fuzzy Prolog parser                     --
  25. --                        Text_io -- Standard i/o packages
  26. --         Unchecked_deallocation -- Used to release bindings (private)      --
  27. --                                                                           --
  28. --  Description:  This package contains only one visible routine:  Prove.    --
  29. --       This procedure processes one request, which must take the form of   --
  30. --       an expression.                                                      --
  31. --            Note that the rule_base may be modified by asserts/retracts    --
  32. --       when processing a request.  These side effects are not undone by    --
  33. --       backtracking (the same as Prolog--but important nonetheless).       --
  34. --                                                                           --
  35. -------------------------------------------------------------------------------
  36. --                                                                           --
  37. --                            Package Specification                          --
  38. --                                                                           --
  39. -------------------------------------------------------------------------------
  40.  
  41. with avl, data_def, listing, math, parser, text_io, unchecked_deallocation;
  42. use data_def, listing, math, parser, text_io;
  43. package prover is
  44.  
  45.     procedure prove( goal : in AST_ptr );
  46.  
  47.     prover_error : exception;  -- raised when bizarre errors occur
  48.  
  49. private
  50.  
  51.     package fp_io is new float_io(float); use fp_io;
  52.     package int_io is new integer_io(integer); use int_io;
  53.     package arg_io is new enumeration_io(argument_type); use arg_io;
  54.     package token_io is new enumeration_io(token_type); use token_io;
  55.     package node_io is new enumeration_io(AST_node_type); use node_io;
  56.  
  57.     --
  58.     --  Set up the generic AVL tree package used to maintain the optimized
  59.     --  rule base.
  60.     --
  61.     function clause_equal( a, b : AST_ptr ) return boolean;
  62.     function clause_less_than( a, b : AST_ptr ) return boolean;
  63.     package AVLs is new avl(AST, AST_ptr, clause_equal, clause_less_than);
  64.     use AVLs;
  65.  
  66.     procedure free_binding is new unchecked_deallocation(binding, binding_list);
  67.  
  68. end prover;
  69.